<template>
  <div class="container">
    <el-card shadow="always">
      <el-row :gutter="20">
        <el-col :span="6">
          <el-input
            maxlength="50"
            v-model="query.searchValue"
            clearable
            placeholder="请输入人员姓名"
          ></el-input>
        </el-col>
        <!-- <el-col :span="4">
          <el-select
            v-model="query.isTrain"
            placeholder="请选择检测结果"
          >
            <el-option
              v-for="item in [
                { text: '是否公示', value: '-1' },
      { text: '允许公示', value: '1' },
      { text: '不允许公示', value: '0' },
              ]"
              :key="item.text"
              :label="item.text"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-col> -->
        <!-- <el-col :span="4">
          <el-select v-model="query.isLogin" placeholder="请选择品种类别">
            <el-option
              v-for="item in [{ text: '是否登录', value: '-1' },
      { text: '允许登录', value: '1' },
      { text: '不允许登录', value: '0' },]"
              :key="item.text"
              :label="item.text"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-col> -->
        <!-- <el-col :span="4">
          <el-select v-model="value" placeholder="请选择考核结果" clearable>
            <el-option
              v-for="item in options"
              :key="item"
              :label="item"
              :value="item"
            >
            </el-option>
          </el-select>
        </el-col> -->
        <el-col :span="2">
          <el-button
            type="primary"
            @click="
              query.page = 1;
              getList();
            "
            >查询</el-button
          >
        </el-col>
      </el-row>
      <rz-height></rz-height>

      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="memberName" label="姓名"> </el-table-column>
        <el-table-column prop="mobile" label="手机号"> </el-table-column>
        <el-table-column prop="memberTitle" label="职务"> </el-table-column>
        <!-- <el-table-column prop="isPublicityStr" label="是否公示" ></el-table-column> -->
        <!-- <el-table-column prop="" label="操作">
          <template slot-scope="scope">
            <el-button size="mini" type="primary" @click="view(scope.row)"
              >查看</el-button
            >
          </template>
        </el-table-column> -->
      </el-table>
      <pagination
        :total="total"
        @pagination="getList"
        :page.sync="query.page"
      />
    </el-card>
    <rz-dialog
      :dialogVisible.sync="dialogVisible"
      :isShowConfirm="false"
      title="查看食安检测"
    >
      <el-form label-width="120px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名">
              {{ data.memberName }}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="手机号">
              {{ data.mobile }}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="学历"> {{ data.education }} </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工作经历">
              {{ data.workExperience }}
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="是否登录">
              {{ data.isLoginStr }}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否培训">
              {{ data.isTrainStr }}
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="培训情况">
              {{ data.training }}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否公示">
              {{ data.isPublicityStr }}
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="备注">
              {{ data.remarks }}
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </rz-dialog>
  </div>
</template>
<script>
//
import {
  // memberFindListByCondition,
  // memberFindResponseById,
  findListByConditionMember
} from "@/api/modules/chain";
export default {
  // props:[],
  // 页面加载
  created() {
    this.getList();
  },
  // 页面加载完成
  mounted() {},
  //实例销毁之前
  beforeDestroy() {},
  //实例销毁后
  destroyed() {},
  data() {
    return {
      //   options: ["合格", "不需要考核"],
      query: {
        // isLogin: "-1",
        // isPublicity: "-1",
        // isTrain: "-1",
        // isPage: 0,
        // page: 1,
        // pageSize: 10,
        // searchValue: "",
        // workStationId: sessionStorage.getItem("workId"),
        isLogin: "-1",
isPage: 0,
isPublicity: "-1",
isTrain: "-1",
page: 1,
pageSize: 10,
searchValue: "",
workStationId:sessionStorage.getItem("chainId"),
      },
      tableData: [],
      total: 0,
      dialogVisible: false,
      data: {},
    };
  },
  // 方法
  methods: {
    getList() {
      findListByConditionMember(this.query).then((res) => {
        // res.data.forEach((x) => {
        //   for (const key in x) {
        //     if (!x[key]) {
        //       x[key] = "--";
        //     }
        //   }
        // });
        this.total = res.totalCount;
        this.tableData = res.data;
      });
    },
    view(e) {
      memberFindResponseById({
        params: { id: e.id },
      }).then((res) => {
        for (const key in res.data) {
          if (!res.data[key]) {
            res.data[key] = "--";
          }
        }
        this.data = res.data;
        this.dialogVisible = true;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.title {
  font-weight: 700;
  font-size: 16px;
}
</style>